package com.example.moduletesta;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
@RestController
@Slf4j
public class ModuleTestaApplication {

    public static void main(String[] args) {
        SpringApplication.run(ModuleTestaApplication.class, args);
    }

    @PostMapping("send")
    public String sendData(){
        Map<String,Object> bodyMap = new HashMap<>();
        bodyMap.put("testData", "1");
        bodyMap.put("status", "success");
        HttpRequest.post("http://10.20.20.40:9444/cn.sxever_yrj_group.pdm.topic.sendDataTestDemo")
                .header("OperationCode","cn.sxever_yrj_group.pdm.topic.sendDataTestDemo")
                .body(JSONUtil.toJsonStr(bodyMap)).execute().body();
        return "分发成功";
    }
}
